#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>

using namespace std;


class Solution {
public:
    static string addStrings(string num1, string num2) {
        int end1 = num1.size() - 1;
        int end2 = num2.size() - 1;

        string n;
        int carry = 0;
        while (end1 >= 0 || end2 >= 0)
        {
            int n1 = end1 >= 0 ? num1[end1--] - '0' : 0;
            int n2 = end2 >= 0 ? num2[end2--] - '0' : 0;
            
            int num = (n1 + n2 + carry) % 10;
            carry = (n1 + n2 + carry) / 10;
            

            n += num + '0';

        }


        if (carry != 0)
        {
            n += '1';
        }

        std::reverse(n.begin(), n.end());
        return n;

    }
};


int main()
{

    string q1 = "9";
    string q2 = "99";

    Solution::addStrings(q1, q2);
    return 0;
}